using System;
using System.Windows.Forms;
using BLL;
using Common;
using Model;

namespace UI {
    public partial class FrmMemberRecycleBin : Form {
        private MemberBLL _memberBLL = MemberBLL.GetMemberBll();
        public FrmMemberRecycleBin() {
            InitializeComponent();
            StartPosition = FormStartPosition.CenterScreen;
        }

        private void FrmMemberRecycleBin_Load(object sender, EventArgs e) {
            UpdateDGV();
        }

        private void UpdateDGV() {
            dgvMemmber.DataSource = _memberBLL.GetAllMember(true);
        }


        private void button1_Click(object sender, EventArgs e) {
            Result<Member> result =  _memberBLL.DeleteMember(
                new Member() { Mid = int.Parse(dgvMemmber.CurrentRow.Cells["mid"].Value.ToString()) }, false);
            MessageBox.Show(result.Message);
            UpdateDGV();
        }
    }
}